\doxysection{servo\+\_\+motor.\+h}
\hypertarget{servo__motor_8h_source}{}\label{servo__motor_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/servo\_motor/servo\_motor.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/servo\_motor/servo\_motor.h}}
\mbox{\hyperlink{servo__motor_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#ifndef\ SERVO\_MOTOR\_H}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#define\ SERVO\_MOTOR\_H}}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{main_8h}{main.h}}"{}}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{tim_8h}{tim.h}}"{}}}
\DoxyCodeLine{00017\ \textcolor{comment}{//\ \#include\ <stdint-\/gcc.h>}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#define\ SERVO\_MOTOR\_CNT\ 7}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{comment}{/*各种舵机类型*/}}
\DoxyCodeLine{00022\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{enum}}
\DoxyCodeLine{00023\ \{}
\DoxyCodeLine{00024\ \ \ \ \ Servo180\ =\ 0,}
\DoxyCodeLine{00025\ \ \ \ \ Servo270\ =\ 1,}
\DoxyCodeLine{00026\ \ \ \ \ Servo360\ =\ 2,}
\DoxyCodeLine{00027\ \}\ Servo\_Type\_e;}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \textcolor{comment}{/*舵机模式选择*/}}
\DoxyCodeLine{00030\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{enum}}
\DoxyCodeLine{00031\ \{}
\DoxyCodeLine{00032\ \ \ \ \ Free\_Angle\_mode,\ \textcolor{comment}{//\ 任意角度模式}}
\DoxyCodeLine{00033\ \ \ \ \ Start\_mode,\ \ \ \ \ \ \textcolor{comment}{//\ 起始角度模式}}
\DoxyCodeLine{00034\ \ \ \ \ Final\_mode,\ \ \ \ \ \ \textcolor{comment}{//\ 终止角度模式}}
\DoxyCodeLine{00035\ \}\ Servo\_Angle\_Type\_e;}
\DoxyCodeLine{00036\ \textcolor{comment}{/*角度设置*/}}
\DoxyCodeLine{00037\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00038\ \{}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{comment}{/*起止角度模式设置值*/}}
\DoxyCodeLine{00040\ \ \ \ \ int16\_t\ Init\_angle;}
\DoxyCodeLine{00041\ \ \ \ \ int16\_t\ Final\_angle;}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{comment}{/*任意角度模式设置值*/}}
\DoxyCodeLine{00043\ \ \ \ \ int16\_t\ free\_angle;}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{comment}{/*下述值仅仅适用于360°舵机}}
\DoxyCodeLine{00045\ \textcolor{comment}{\ \ \ \ \ *设定值为0-\/100\ 为速度值百分比}}
\DoxyCodeLine{00046\ \textcolor{comment}{\ \ \ \ \ *0-\/50为正转\ 速度由快到慢}}
\DoxyCodeLine{00047\ \textcolor{comment}{\ \ \ \ \ *51-\/100为反转\ 速度由慢到快}}
\DoxyCodeLine{00048\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00049\ \ \ \ \ int16\_t\ servo360speed;}
\DoxyCodeLine{00050\ \}\ \mbox{\hyperlink{struct_servo___angle__s}{Servo\_Angle\_s}};}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ \textcolor{comment}{/*\ 用于初始化不同舵机的结构体,各类舵机通用\ */}}
\DoxyCodeLine{00053\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00054\ \{}
\DoxyCodeLine{00055\ \ \ \ \ Servo\_Type\_e\ Servo\_type;}
\DoxyCodeLine{00056\ \ \ \ \ Servo\_Angle\_Type\_e\ Servo\_Angle\_Type;}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{comment}{//\ 使用的定时器类型及通道}}
\DoxyCodeLine{00058\ \ \ \ \ \mbox{\hyperlink{struct_t_i_m___handle_type_def}{TIM\_HandleTypeDef}}\ *htim;}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{comment}{/*Channel值设定}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_1}}
\DoxyCodeLine{00061\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_2}}
\DoxyCodeLine{00062\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_3}}
\DoxyCodeLine{00063\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_4}}
\DoxyCodeLine{00064\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_ALL}}
\DoxyCodeLine{00065\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00066\ \ \ \ \ uint32\_t\ Channel;}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \}\ \mbox{\hyperlink{struct_servo___init___config__s}{Servo\_Init\_Config\_s}};}
\DoxyCodeLine{00069\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00070\ \{}
\DoxyCodeLine{00071\ \ \ \ \ Servo\_Angle\_Type\_e\ Servo\_Angle\_Type;}
\DoxyCodeLine{00072\ \ \ \ \ \mbox{\hyperlink{struct_servo___angle__s}{Servo\_Angle\_s}}\ Servo\_Angle;}
\DoxyCodeLine{00073\ \ \ \ \ Servo\_Type\_e\ Servo\_type;}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{comment}{//\ 使用的定时器类型及通道}}
\DoxyCodeLine{00075\ \ \ \ \ \mbox{\hyperlink{struct_t_i_m___handle_type_def}{TIM\_HandleTypeDef}}\ *htim;}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{comment}{/*Channel值设定}}
\DoxyCodeLine{00077\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_1}}
\DoxyCodeLine{00078\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_2}}
\DoxyCodeLine{00079\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_3}}
\DoxyCodeLine{00080\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_4}}
\DoxyCodeLine{00081\ \textcolor{comment}{\ \ \ \ \ *TIM\_CHANNEL\_ALL}}
\DoxyCodeLine{00082\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00083\ \ \ \ \ uint32\_t\ Channel;}
\DoxyCodeLine{00084\ \}\ \mbox{\hyperlink{struct_servo_instance}{ServoInstance}};}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \mbox{\hyperlink{struct_servo_instance}{ServoInstance}}\ *ServoInit(\mbox{\hyperlink{struct_servo___init___config__s}{Servo\_Init\_Config\_s}}\ *Servo\_Init\_Config);}
\DoxyCodeLine{00087\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{servo__motor_8h_ac4157b72fa36b65b683660b86b9da612}{Servo\_Motor\_FreeAngle\_Set}}(\mbox{\hyperlink{struct_servo_instance}{ServoInstance}}\ *Servo\_Motor,\ int16\_t\ S\_angle);}
\DoxyCodeLine{00088\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{servo__motor_8h_a871a49699fa114b54020843e1e149f25}{Servo\_Motor\_Type\_Select}}(\mbox{\hyperlink{struct_servo_instance}{ServoInstance}}\ *Servo\_Motor,int16\_t\ mode);}
\DoxyCodeLine{00089\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{servo__motor_8h_a358e789daa68380f02b5c7cc5f79903b}{ServeoMotorControl}}();}
\DoxyCodeLine{00090\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ SERVO\_MOTOR\_H}}

\end{DoxyCode}
